package com.tedu.api;

import org.junit.Test;


public class 作业 {
     @Test
       public void testlength()  {
        String str = "Hello Java";
        System.out.println(str.length());
        char c=str.charAt(4);
        System.out.println(c);
        int index = str.indexOf('o');
        if (index != -1)  {
            String subStr = str.substring(index);
            System.out.println(subStr);  }
         str=str.substring(0,5);
         System.out.println(str);
         str=str.substring(6);
         System.out.println(str);
         String trimmedStr = str.trim();
         System.out.println(trimmedStr);
         char charAtIndex6 = str.charAt(6);
         System.out.println(charAtIndex6);
         str=str.trim().toUpperCase();
         System.out.println(str);
         str=str.trim().toLowerCase();
    }



  //1
    @Test
    public void testLenght(){
        String str="HelloJava";
        System.out.println(str.length());
    }
    //2
    @Test
    public void testIndexOf(){
        String str="HelloJava";
        int index=str.indexOf("o");
        System.out.println(index);
        //3
        index = str.indexOf("o", 4);
        System.out.println(index);
    }
    //4
    @Test
    public void testSubString(){
        String str="HelloJava";
        str=str.substring(0,5);
        System.out.println(str);
    }
    //5
    @Test
    public void testSubStrings(){
        String str="HelloJava";
        str=str.substring(5);
        System.out.println(str);
    }
    //6
    @Test
    public void testTrim(){
        String str=" Hello ";
        str=str.trim();
        System.out.println(str);
    }
    //7
    @Test
    public void testChartAt(){
        String str="HelloJava";
        char c=str.charAt(5);
        System.out.println(c);
    }
    //8
    @Test
    public void testToCase(){
        String str="HelloJava";
        str=str.toUpperCase();
        System.out.println(str);
        str=str.toLowerCase();
        System.out.println(str);
    }

}